/*     */ package dm.jdbc.driver;
/*     */ 
/*     */ import dm.jdbc.dbaccess.DBError;
/*     */ import dm.jdbc.dbaccess.DmMsgSend;
/*     */ import dm.jdbc.desc.ParameterDesc;
/*     */ import java.sql.SQLException;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class DmOutParamBinder
/*     */   extends DmBinder
/*     */ {
/*  14 */   public DmBinder m_inParamBinder = null;
/*     */   
/*     */ 
/*  17 */   DmdbStatement_bs curStmt = null;
/*     */   
/*  19 */   boolean isOutNull = false;
/*  20 */   byte[] outValue = null;
/*     */   
/*     */   public DmOutParamBinder(DmdbPreparedStatement_bs pstmt) {
/*  23 */     super(pstmt);
/*     */     
/*  25 */     this.hasSqlScale = false;
/*  26 */     this.hasSqlType = false;
/*     */   }
/*     */   
/*     */   public DmOutParamBinder(DmdbPreparedStatement_bs pstmt, int sqlType) {
/*  30 */     this(pstmt);
/*     */     
/*  32 */     this.sqlType = sqlType;
/*  33 */     this.hasSqlType = true;
/*     */   }
/*     */   
/*     */   public DmOutParamBinder(DmdbPreparedStatement_bs pstmt, int sqlType, int sqlScale)
/*     */   {
/*  38 */     this(pstmt, sqlType);
/*     */     
/*  40 */     this.sqlScale = sqlScale;
/*  41 */     this.hasSqlScale = true;
/*     */   }
/*     */   
/*     */ 
/*     */   void init() {}
/*     */   
/*     */   public void setCursorStmt(DmdbStatement_bs stmt)
/*     */   {
/*  49 */     this.curStmt = stmt;
/*     */   }
/*     */   
/*     */   void checkType(int icol, boolean forBatch) throws SQLException {
/*  53 */     if (this.m_checkType) {
/*  54 */       return;
/*     */     }
/*  56 */     this.m_checkType = true;
/*     */     
/*  58 */     if (this.paramsDesc == null) {
/*  59 */       this.paramsDesc = this.pstmt.getParamsDesc();
/*     */     }
/*  61 */     this.destDType = this.paramsDesc[icol].getDType();
/*  62 */     this.destPrec = this.paramsDesc[icol].getPrec();
/*  63 */     this.destScale = this.paramsDesc[icol].getScale();
/*  64 */     this.destIoType = this.paramsDesc[icol].getIOType();
/*     */     
/*  66 */     if ((this.destIoType == 1) && 
/*  67 */       (this.destDType == 120)) {
/*  68 */       this.destIoType = 2;
/*     */     }
/*     */   }
/*     */   
/*     */   public int bindData(DmMsgSend msg, int irow, int icol, boolean forBatch) throws SQLException {
/*  73 */     int retLen = 0;
/*     */     
/*  75 */     if (120 == this.destDType) {
/*  76 */       if (this.curStmt == null) {
/*  77 */         DBError.throwSQLException(6048);
/*     */       }
/*  79 */       msg.setShort(4);
/*  80 */       msg.setInt(this.curStmt.getHandle());
/*     */       
/*  82 */       retLen = 6;
/*  83 */     } else if (this.destIoType == 2) {
/*  84 */       if (this.m_inParamBinder == null) {
/*  85 */         DBError.throwSQLException(6054);
/*     */       }
/*  87 */       this.m_inParamBinder.checkType(icol, forBatch);
/*     */       
/*  89 */       byte[][] isNull = this.pstmt.getNullIndicator();
/*     */       
/*  91 */       if ((isNull[irow][icol] == 1) || 
/*  92 */         ((this.m_inParamBinder instanceof DmNullBinder))) {
/*  93 */         retLen = DmNullBinder.bindData(msg);
/*     */       } else {
/*  95 */         retLen = this.m_inParamBinder.bindData(msg, irow, icol, forBatch);
/*     */       }
/*     */     }
/*  98 */     return retLen;
/*     */   }
/*     */   
/*     */   public void setInoutParamBinder(DmBinder inBinder) throws SQLException {
/* 102 */     if (this.m_inParamBinder == null) {
/* 103 */       this.m_inParamBinder = inBinder;
/* 104 */     } else if ((this.m_inParamBinder instanceof DmNullBinder)) {
/* 105 */       this.m_inParamBinder = inBinder;
/* 106 */     } else if ((inBinder != null) && 
/* 107 */       (this.m_inParamBinder.getClass() != inBinder.getClass())) {
/* 108 */       throw new SQLException(
/* 109 */         "Different object bound with the first row in the same column");
/*     */     }
/* 111 */     this.m_inParamBinder = inBinder;
/*     */   }
/*     */   
/*     */   public DmBinder getInoutParamBinder() throws SQLException {
/* 115 */     return this.m_inParamBinder;
/*     */   }
/*     */   
/*     */   public DmdbStatement_bs getCursorStmt() throws SQLException {
/* 119 */     return this.curStmt;
/*     */   }
/*     */   
/*     */   public void setOutNullFlag(boolean flag) throws SQLException {
/* 123 */     this.isOutNull = flag;
/*     */   }
/*     */   
/*     */   public boolean getOutNullFlag() throws SQLException {
/* 127 */     return this.isOutNull;
/*     */   }
/*     */   
/*     */   public void setOutValue(byte[] out) throws SQLException {
/* 131 */     this.outValue = out;
/*     */   }
/*     */   
/*     */   public byte[] getOutValue() throws SQLException {
/* 135 */     return this.outValue;
/*     */   }
/*     */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\driver\DmOutParamBinder.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */